﻿using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.Text;
using Texfina.Core.Common;
using Texfina.Common.Mg;
using Texfina.Core.Web;
using Texfina.Core.Data;
using Texfina.Entity.Pd;
using Texfina.Entity.Mg;
using Texfina.Entity.Sy;
using PDBOQry = Texfina.BOQry.Pd;
using RHBOQry = Texfina.BOQry.Rh;
using MGBOQry = Texfina.BOQry.Mg;
using RHBOMnt = Texfina.BOMnt.Rh;
using SYBOQry = Texfina.BOQry.Sy;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;

namespace PD
{
   public partial class wfClienteMnt : EditPage
   {
      /// <summary>
      /// Guarda el estado de un DataTable, se usa para las remuneraciones del personal
      /// </summary>
      /// <value></value>
      /// <returns></returns>
       public DataTable DataSourceRem
       {
           get { return (DataTable)this.ViewState["_dsRem"]; }
           set { this.ViewState["_dsRem"] = value; }
       }

       /// <summary>
       /// Guarda el Indice del Registro en Edicion en un GridView
       /// </summary>
       /// <value></value>
       /// <returns></returns>
       public int EditRowIndexRem
       {
           get { return Convert.ToInt32(this.ViewState["_erowIdxRem"]); }
           set { this.ViewState["_erowIdxRem"] = value.ToString(); }
       }

       public GridEditAction GridEditActionRem
       {
           get { return (GridEditAction)this.ViewState["_gridEditRem"]; }
           set { this.ViewState["_gridEditRem"] = value; }
       }

       public const int _GRDLIST_STANULADOREM = 6;

       public string _STFOTO
       {
           get { return (string)this.ViewState["_STFOTO"]; }
           set { this.ViewState["_STFOTO"] = value; }
       }

       protected void Page_Load(object sender, EventArgs e)
       {
           if (this.IsPostBack)
           {
               this.LoadInPostBack();
               return;
           }
           this.LoadData();
       }

       public override void LoadInPostBack()
       {
           this.RegisterGeneralScripts();
       }

       public override void LoadInitialSettings()
       {
           this.FormEditAction = (FormEditAction)Enum.Parse(typeof(FormEditAction), Request.QueryString["formEA"]);
           this.SetInitialTitle("Cliente");
       }

       public override void LoadListControls()
       {
           ETablaGenDet objEDet = new ETablaGenDet();
           //ETablaPEDet objEDetPE = new ETablaPEDet();
           ECCosto objECCosto = new ECCosto();
           EEmpEstable objEEmp = new EEmpEstable();
           EBanco objEBanco = new EBanco();
           EUNegocio objEUNeg = new EUNegocio();

           IBOQuery objBOUNego = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(MGBOQry.UNegocio));
           IBOQuery objBOCCosto = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(MGBOQry.CCosto));
           IBOQuery objBOBanco = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(MGBOQry.Banco));
           MGBOQry.ITablaGen objBOI = (MGBOQry.ITablaGen)WCFHelper.GetObject<MGBOQry.ITablaGen>(typeof(MGBOQry.TablaGen));
           RHBOQry.ITablaPE objBOIPE = (RHBOQry.ITablaPE)WCFHelper.GetObject<RHBOQry.ITablaPE>(typeof(RHBOQry.TablaPE));
           SYBOQry.IEmpresa objBOEmp = (SYBOQry.IEmpresa)WCFHelper.GetObject<SYBOQry.IEmpresa>(typeof(SYBOQry.Empresa));

           objEDet.IdTabla = ConstMultitabla.TIPO_DOCUMENTO;
           DataTable dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTDocIden, dt, "dsAbrev", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.CATEGORIA_TRABAJADOR;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidCateTrab, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_COLABORADOR;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoTrab, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.SEXO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidSexo, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_VIA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoVia, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.CATEGORIA_OCUPACIONAL;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidCateOcup, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.REGIMEN_LABORAL;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidRegLaboral, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.NIVEL_EDUCATIVO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidNivEduc, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.REGIME_PENSIONARIO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidRegPensi, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.SEGURO_MEDICO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidSctrSalud, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.SEGURO_PENSION;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidSctrPens, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_CONTRATO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoCont, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.PERIODO_REMUNERACION;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidPeriRemu, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.CENTRO_FORMACION;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidCentroFP, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.EMPRESA_PRESTADORA_EPS;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidEmpEps, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.SITUACION_TRABAJADOR;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidSituEmple, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_REMUNERACION;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoRemu, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.MOTIVO_CESE;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidMotivFin, dt, "dsDescrip", "idCodigo", true, true);

           objEDet.IdTabla = ConstMultitabla.TIPO_MODALIDAD_FORMATIVA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoCenFP, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.ESTADO_CIVIL;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidEstaCivil, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_CUENTA_BANCARIA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoCtaAbono, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_ZONA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoZona, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_SANGRE;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipoSangre, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.FORMA_PAGO;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidForPago, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_REMUNERACION_BASICA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidTipRemu, dt, "dsDescrip", "idCodigo", true, false);

           objEDet.IdTabla = ConstMultitabla.TIPO_MONEDA;
           dt = objBOI.GetDetailByList(objEDet);
           WebHelper.LoadListControl(ddlidMoneda, dt, "dsDescrip", "idCodigo", true, false);

           objEUNeg.IdEmpresa = Session[ConstSessionVar.EMPRESA].ToString();
           dt = objBOUNego.GetList(objEUNeg);
           WebHelper.LoadListControl(ddlidUNegocio, dt, "dsUNegocio", "idUNegocio", true, false);

           //objECCosto.IdEmpresa = Session[ConstSessionVar.EMPRESA].ToString();
           //dt = objBOCCosto.GetList(objECCosto);
           //WebHelper.LoadListControl(ddlidCCosto, dt, "dsCCosto", "idCCosto", true, true);

           objEEmp.IdEmpresa = Session[ConstSessionVar.EMPRESA].ToString();
           dt = objBOEmp.GetEstablecimientos(objEEmp);
           WebHelper.LoadListControl(ddlidEstable, dt, "dsEstable", "idEstable", true, false);

           objEBanco.IdBanco = "";
           dt = objBOBanco.GetList(objEBanco);
           WebHelper.LoadListControl(ddlidBcoAbono, dt, "dsBanco", "idBanco", true, false);
           WebHelper.LoadListControl(ddlidBcoCts, dt, "dsBanco", "idBanco", true, false);
       }

       public override void DataToControls()
       {
           ECliente objE = new ECliente();
           IBOQuery objBO = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(PDBOQry.Cliente));
           objE.IdEmpresa = Session[ConstSessionVar.EMPRESA].ToString();
           objE.IdCliente = Request.QueryString["IdCliente"];
           objE = (ECliente)objBO.GetByKey(objE);


       }

       public override void RegisterGeneralScripts()
       {
           this.txtidPersonal.Attributes.Add("readonly", "true");
           this.txtidFotografia.Attributes.Add("readonly", "true");
           this.txtidOcupa.Attributes.Add("readonly", "true");
           this.txtnuRUC.Attributes.Add("readonly", "true");
           //this.tabChildPrinci.Attributes.Add("disabled", "true");
           //this.tabChildDComple.Attributes.Add("disabled", "true");

           StringBuilder sb = new StringBuilder();

           sb.AppendLine("var varRet = modalDialog('../MG/wfUbigeoBnd.aspx',725,400);");
           sb.AppendLine("if(varRet==null)");
           sb.AppendLine("return false;");
           sb.AppendLine("ctl = document.getElementById('" + this.hdnidPais.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[0];");
           sb.AppendLine("ctl = document.getElementById('" + this.hdnidDepa.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[2];");
           sb.AppendLine("ctl = document.getElementById('" + this.hdnidProv.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[4];");
           sb.AppendLine("ctl = document.getElementById('" + this.hdnidDist.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[6];");
           sb.AppendLine("ctl = document.getElementById('" + this.txtdsUbigeo.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[1] + ' / ' + varRet[3] + ' / ' + varRet[5] + ' / ' + varRet[7];");
           sb.AppendLine("ctl.title = ctl.value;");
           this.txtdsUbigeo.OnClientClick = sb.ToString();

           sb = new StringBuilder();

           sb.AppendLine("var varRet = modalDialog('../MG/wfOcupacionBnd.aspx',725,400);");
           sb.AppendLine("if(varRet==null)");
           sb.AppendLine("return false;");
           sb.AppendLine("ctl = document.getElementById('" + this.txtidOcupa.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[0];");
           sb.AppendLine("ctl = document.getElementById('" + this.txtdsOcupa.ClientID + "');");
           sb.AppendLine("ctl.value = varRet[1];");
           this.txtdsOcupa.OnClientClick = sb.ToString();

           sb = new StringBuilder();

           sb.AppendLine("function validateEditForm(key){");
           sb.AppendLine("var varRpta = isEmptyControl('" + txtdsAPaterno.ClientID + "','Ingrese el Apellido Paterno');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtdsAPaterno.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + txtdsAMaterno.ClientID + "','Ingrese el Apellido Materno');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtdsAMaterno.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + txtdsNombres.ClientID + "','Ingrese los Nombres');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtdsNombres.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + ddlidTDocIden.ClientID + "','Seleccione el tipo de Documento de Identidad');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + ddlidTDocIden.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + txtnuDocIden.ClientID + "','Ingrese el numero de Documento de Identidad');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtnuDocIden.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + txtfeNacimiento.ClientID + "','Seleccione o ingrese la fecha de Nacimiento');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtfeNacimiento.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + ddlidSexo.ClientID + "','Seleccione el Genero');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + ddlidSexo.ClientID + "').focus();return !varRpta;}");

           //sb.AppendLine("var varRpta = isEmptyControl('" + txtnuTelf.ClientID + "','Ingrese el numero de telefono');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + txtnuTelf.ClientID + "').focus();return !varRpta;}");

           sb.AppendLine("var varRpta = isEmptyControl('" + ddlidCCosto.ClientID + "','Seleccione el Centro de Costo');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + ddlidCCosto.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + ddlidEstable.ClientID + "','Seleccione el establecimiento');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + txtnuFotocheck.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("var varRpta = isEmptyControl('" + ddlidCateTrab.ClientID + "','Seleccione la categoria del trabajador');");
           sb.AppendLine("if(varRpta==true){");
           sb.AppendLine("document.getElementById('" + ddlidCateTrab.ClientID + "').focus();return !varRpta;}");
           //sb.AppendLine("var varRpta = isEmptyControl('" + txtdsUbigeo.ClientID + "','Seleccione el Ubigeo');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + txtdsUbigeo.ClientID + "').focus();return !varRpta;}");
           //sb.AppendLine("var varRpta = isEmptyControl('" + ddlidTipoVia.ClientID + "','Seleccione el tipo de via');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + ddlidTipoVia.ClientID + "').focus();return !varRpta;}");
           //sb.AppendLine("var varRpta = isEmptyControl('" + txtdsNombreVia.ClientID + "','Ingrese el nombre de la via');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + txtdsNombreVia.ClientID + "').focus();return !varRpta;}");
           //sb.AppendLine("var varRpta = isEmptyControl('" + ddlidTipoZona.ClientID + "','Seleccione el tipo de zona');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + ddlidTipoZona.ClientID + "').focus();return !varRpta;}");
           //sb.AppendLine("var varRpta = isEmptyControl('" + txtdsNombZona.ClientID + "','Ingrese el nombre de la zona');");
           //sb.AppendLine("if(varRpta==true){");
           //sb.AppendLine("document.getElementById('" + txtdsNombZona.ClientID + "').focus();return !varRpta;}");
           sb.AppendLine("switch (document.getElementById('" + ddlidCateTrab.ClientID + "').value){");
           sb.AppendLine("case '" + ConstCategoriaTrab.TRABAJADOR + "':");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var ddlTipTrab = document.getElementById('" + ddlidTipoTrab.ClientID + "').value;");
           sb.AppendLine("    if(ddlTipTrab != '" + ConstTipoTrabajador.EMPLEADO + "' && ddlTipTrab != '" + ConstTipoTrabajador.EJECUTIVO + "' && ddlTipTrab != '" + ConstTipoTrabajador.OBRERO + "'){");
           sb.AppendLine("        var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("        if(varRpta==true)");
           sb.AppendLine("        return !varRpta;}");
           //sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidRegLaboral.ClientID + "','Seleccione el regimen laboral');");
           //sb.AppendLine("    if(varRpta==true)");
           //sb.AppendLine("    return !varRpta;");
           //sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidNivEduc.ClientID + "','Seleccione el Nivel de Educacion');");
           //sb.AppendLine("    if(varRpta==true)");
           //sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + txtdsOcupa.ClientID + "','Seleccione la Ocupacion.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidRegPensi.ClientID + "','Seleccione el regimen pensionario.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + txtfeInsRegPen.ClientID + "','Ingrese o seleccione la fecha de inscripcion.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + txtnuCuspp.ClientID + "','Ingrese el CUSPP.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidSctrSalud.ClientID + "','Seleccione el SCTR Salud.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidSctrPens.ClientID + "','Seleccione el SCTR Pension.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoCont.ClientID + "','Seleccione el tipo de Contrato.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidSituEmple.ClientID + "','Seleccione la situacion del empleado.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidPeriRemu.ClientID + "','Seleccione el periodo de remuneracion.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           //sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidEstaCivil.ClientID + "','Seleccione el estado civil.');");
           //sb.AppendLine("    if(varRpta==true)");
           //sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoRemu.ClientID + "','Seleccione el tipo de remuneracion.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    break;");
           sb.AppendLine("case '" + ConstCategoriaTrab.PENSIONISTA + "':");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var ddlTipTrab = document.getElementById('" + ddlidTipoTrab.ClientID + "').value;");
           sb.AppendLine("    if(ddlTipTrab != '" + ConstTipoTrabajador.EMPLEADO + "' && ddlTipTrab != '" + ConstTipoTrabajador.EJECUTIVO + "' && ddlTipTrab != '" + ConstTipoTrabajador.OBRERO + "'){");
           sb.AppendLine("        var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("        if(varRpta==true)");
           sb.AppendLine("        return !varRpta;}");
           sb.AppendLine("    break;");
           sb.AppendLine("case '" + ConstCategoriaTrab.PRESTADOR_4ta_CAT + "' :");
           sb.AppendLine("case '" + ConstCategoriaTrab.PERSONAL_TERCEROS + "' :");
           sb.AppendLine("    var varRpta = isEmptyControl('" + txtnuRUC.ClientID + "','Ingrese el numero de ruc');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    break;");
           sb.AppendLine("case '" + ConstCategoriaTrab.PRESTADOR_MOD_FORMATIVA + "' :");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoCenFP.ClientID + "','Seleccione el tipo de Modalidad Formativa');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidCentroFP.ClientID + "','Seleccione el Centro de Formacion');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + txtdsOcupa.ClientID + "','Seleccione la Ocupacion.');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("    if(varRpta==true)");
           sb.AppendLine("    return !varRpta;");
           sb.AppendLine("    var ddlTipTrab = document.getElementById('" + ddlidTipoTrab.ClientID + "').value;");
           sb.AppendLine("    if(ddlTipTrab != '" + ConstTipoTrabajador.EMPLEADO + "' && ddlTipTrab != '" + ConstTipoTrabajador.EJECUTIVO + "' && ddlTipTrab != '" + ConstTipoTrabajador.OBRERO + "'){");
           sb.AppendLine("        var varRpta = isEmptyControl('" + ddlidTipoTrab.ClientID + "','Seleccione el tipo de Trabajador');");
           sb.AppendLine("        if(varRpta==true)");
           sb.AppendLine("        return !varRpta;}");
           sb.AppendLine("    break;");
           sb.AppendLine("}");
           sb.AppendLine("menu_doPostBack('" + mnuToolbar.ClientID + "','" + mnuToolbar.UniqueID + "',key);");
           sb.AppendLine("}");

           sb.AppendLine("function onchange" + this.ddlidCateTrab.ID + "(){");
           sb.AppendLine("var ddl = document.getElementById('" + this.ddlidCateTrab.ClientID + "').value;");
           sb.AppendLine("   switch(ddl){");
           sb.AppendLine("   case '" + ConstCategoriaTrab.TRABAJADOR + "' :");
           sb.AppendLine("      document.getElementById('" + this.chkstMadreResp.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidCentroFP.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidTipoCenFP.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidCateOcup.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegLaboral.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidNivEduc.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegPensi.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtnuCuspp.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrSalud.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrPens.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidTipoCont.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEmpEps.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSituEmple.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidPeriRemu.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEstaCivil.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstDiscapa.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTAtipico.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "_button').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTMaxima.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTHoraNoc.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstOtrosIng5ta.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstSindical.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkst5taExo.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstAsigFami.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.chkstSujRegAlter.ClientID + "').disabled = false;");
           sb.AppendLine("      $('#" + this.txtfeInsRegPen.ClientID + "').datepicker('enable');");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = false;");
           sb.AppendLine("      var tc = $find('" + this.tabMaster.ClientID + "');");
           sb.AppendLine("      tc.get_tabs()[2].set_enabled(true);");
           sb.AppendLine("      tc.get_tabs()[3].set_enabled(true);");
           sb.AppendLine("      break;");
           sb.AppendLine("   case '" + ConstCategoriaTrab.PENSIONISTA + "' :");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegLaboral.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidNivEduc.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegPensi.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtnuCuspp.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrSalud.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrPens.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidTipoCont.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEmpEps.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSituEmple.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidPeriRemu.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEstaCivil.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstMadreResp.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidCentroFP.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidTipoCenFP.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstDiscapa.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTAtipico.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtdsOcupa.ClientID + "_button').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTMaxima.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstJTHoraNoc.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstOtrosIng5ta.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstSindical.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkst5taExo.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstAsigFami.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.chkstSujRegAlter.ClientID + "').disabled = true;");
           sb.AppendLine("      $('#" + this.txtfeInsRegPen.ClientID + "').datepicker('disable');");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = true;");
           sb.AppendLine("      var tc = $find('" + this.tabMaster.ClientID + "');");
           sb.AppendLine("      tc.get_tabs()[2].set_enabled(true);");
           sb.AppendLine("      tc.get_tabs()[3].set_enabled(true);");
           sb.AppendLine("      break;");
           sb.AppendLine("   case '" + ConstCategoriaTrab.PRESTADOR_4ta_CAT + "' :");
           sb.AppendLine("   case '" + ConstCategoriaTrab.PERSONAL_TERCEROS + "' :");
           sb.AppendLine("      document.getElementById('" + this.txtnuRUC.ClientID + "').disabled = false;");
           sb.AppendLine("      var tc = $find('" + this.tabMaster.ClientID + "');");
           sb.AppendLine("      tc.get_tabs()[2].set_enabled(false);");
           sb.AppendLine("      tc.get_tabs()[3].set_enabled(false);");
           sb.AppendLine("      break;");
           sb.AppendLine("   case '" + ConstCategoriaTrab.PRESTADOR_MOD_FORMATIVA + "' :");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegPensi.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.txtnuCuspp.ClientID + "').disabled = false;");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegLaboral.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidNivEduc.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidRegPensi.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtfeInsRegPen.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.txtnuCuspp.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrSalud.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSctrPens.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidTipoCont.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEmpEps.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidSituEmple.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidPeriRemu.ClientID + "').disabled = true;");
           sb.AppendLine("      document.getElementById('" + this.ddlidEstaCivil.ClientID + "').disabled = true;");
           sb.AppendLine("      $('#" + this.txtfeInsRegPen.ClientID + "').datepicker('disable');");
           sb.AppendLine("      var tc = $find('" + this.tabMaster.ClientID + "');");
           sb.AppendLine("      tc.get_tabs()[2].set_enabled(true);");
           sb.AppendLine("      tc.get_tabs()[3].set_enabled(false);");
           sb.AppendLine("      break;");
           sb.AppendLine("   };");
           sb.AppendLine("};");

           ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptRegister", sb.ToString(), true);

           this.ddlidCateTrab.Attributes.Add("onchange", "onchange" + ddlidCateTrab.ID + "()");
       }

       public void RegisterEditPopupScripts()
       {
           StringBuilder sb = new StringBuilder();

           sb.AppendLine("function validate" + this.bttOkPopupRem.ID + "(){");
           sb.AppendLine("varRpta = isEmptyControl('" + this.ddlidForPago.ClientID + "','Seleccionar la Forma de Pago.');");
           sb.AppendLine("if(varRpta==true)");
           sb.AppendLine("return !varRpta;");
           sb.AppendLine("varRpta = isEmptyControl('" + this.ddlidTipRemu.ClientID + "','Ingrese el tipo de remuneración basica.');");
           sb.AppendLine("if(varRpta==true)");
           sb.AppendLine("return !varRpta;");
           sb.AppendLine("varRpta = isEmptyControl('" + this.ddlidMoneda.ClientID + "','Ingrese la Moneda de la remuneración.');");
           sb.AppendLine("if(varRpta==true)");
           sb.AppendLine("return !varRpta;");
           sb.AppendLine("varRpta = isEmptyControl('" + this.txtmtRemu.ClientID + "','Ingrese el monto de la remuneración.');");
           sb.AppendLine("if(varRpta==true)");
           sb.AppendLine("return !varRpta;");
           sb.AppendLine("}");

           ScriptManager.RegisterStartupScript(this, this.GetType(), "validatePopup", sb.ToString(), true);

           this.bttOkPopupRem.OnClientClick = "return validate" + bttOkPopupRem.ID + "();";
           this.bttCancelPopupRem.OnClientClick = "$find('" + this.mdlPopupRem.ClientID + "').hide();return false;";


       }

       protected void bttOkPopupRem_Click(object sender, EventArgs e)
       {
           DataTable dt = (DataTable)this.DataSourceRem;
           DataRow dr = dt.NewRow();

           if (this.GridEditActionRem == GridEditAction.AddNew || this.GridEditActionRem == GridEditAction.Copy)
               dr = dt.NewRow();
           else
               dr = this.GridGetRowFromDataKey(this.DataSourceRem, grdListRem, this.EditRowIndexRem);

           if (this.GridEditActionRem != GridEditAction.Delete)
           {
               dr["idEmpresa"] = Session[ConstSessionVar.EMPRESA].ToString();
               dr["idPersonal"] = Request.QueryString["IdPersonal"];
               dr["idForPago"] = this.ddlidForPago.SelectedItem.Value;
               dr["dsForPago"] = this.ddlidForPago.SelectedItem.Text;
               dr["idTipoRemu"] = this.ddlidTipRemu.SelectedItem.Value;
               dr["dsTipoRemu"] = this.ddlidTipRemu.SelectedItem.Text;
               dr["idMoneda"] = this.ddlidMoneda.SelectedItem.Value;
               dr["dsMoneda"] = this.ddlidMoneda.SelectedItem.Text;
               dr["mtRemu"] = this.txtmtRemu.Text;
               dr["stAprobado"] = ConstFlagEstado.DESACTIVADO;
               dr["stAnulado"] = ConstFlagEstado.DESACTIVADO;

           }
           else
           {
               dr["stAnulado"] = ConstFlagEstado.ACTIVADO;
           }

           if (this.GridEditActionRem == GridEditAction.AddNew || this.GridEditActionRem == GridEditAction.Copy)
           {
               dt.Rows.Add(dr);
           }

           this.DataSourceRem = dt;
           grdListRem.DataSource = this.DataSourceRem;
           grdListRem.DataBind();
       }

       protected void mnuToolbar_MenuItemClick(Object sender, MenuEventArgs e)
       {
           if (e.Item == null)
               return;

           switch (e.Item.Value)
           {
               case ConstMenuToolbarValue.BUTTON_SAVE:
               case ConstMenuToolbarValue.BUTTON_SAVENEW:
                   if (this.FormEditAction != FormEditAction.Delete)
                       this.SaveData(e.Item.Value);
                   else
                       this.DeleteData();
                   break;

               case ConstMenuToolbarValue.BUTTON_EXIT:
                   this.Response.Redirect("wfPersonalBnd.aspx");
                   break;
           }

       }

       protected void mnuGridRem_MenuItemClick(Object sender, MenuEventArgs e)
       {
           if (e.Item == null)
               return;

           switch (e.Item.Value)
           {
               case ConstMenuToolbarValue.BUTTON_NEW:
                   this.GridEditActionRem = GridEditAction.AddNew;
                   this.lblTitlePopup.Text = "Remuneraciones (Nuevo)";
                   this.mdlPopupRem.Show();
                   this.LoadDataEditPopup(grdListRem, -1);
                   this.RegisterEditPopupScripts();
                   break;
           }

       }


       protected void grdListRem_RowCommand(Object sender, GridViewCommandEventArgs e)
       {
           this.EditRowIndexRem = Convert.ToInt32(e.CommandArgument);

           switch (e.CommandName)
           {
               case ConstGridRowCommand.GRIDEDIT:
                   this.lblTitlePopup.Text = "Remuneración (Editar)";
                   this.GridEditActionRem = GridEditAction.Edit;
                   this.mdlPopupRem.Show();
                   this.LoadDataEditPopup(grdListRem, this.EditRowIndexRem);
                   this.RegisterEditPopupScripts();
                   break;
               case ConstGridRowCommand.GRIDDELETE:
                   this.lblTitlePopup.Text = "Remuneración (Eliminar)";
                   this.GridEditActionRem = GridEditAction.Delete;
                   this.mdlPopupRem.Show();
                   this.LoadDataEditPopup(grdListRem, this.EditRowIndexRem);
                   this.RegisterEditPopupScripts();
                   break;
           }
       }

       protected void grdListRem_RowDataBound(Object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {
               String strRI = e.Row.RowIndex.ToString();

               ImageButton bttedit = (ImageButton)e.Row.FindControl("grdBtt" + ConstGridRowCommand.GRIDEDIT);
               ImageButton bttdelete = (ImageButton)e.Row.FindControl("grdBtt" + ConstGridRowCommand.GRIDDELETE);

               if (e.Row.Cells[_GRDLIST_STANULADOREM].Text == ConstFlagEstado.ACTIVADO)
               {
                   e.Row.ForeColor = System.Drawing.Color.Red;
                   bttedit.ImageUrl = "../Images/Icons/Disabled/Edit.png";
                   bttdelete.ImageUrl = "../Images/Icons/Disabled/Delete.png";
               }
               else
               {
                   e.Row.ForeColor = System.Drawing.Color.Green;

               }
           }
       }

       protected void ddlidUNegocio_SelectedIndexChanged(object sender, EventArgs e)
       {
           ddlidCCosto.Items.Clear();
           EUNegocio objEUNeg = new EUNegocio();
           MGBOQry.IUNegocio objBOUNego = (MGBOQry.IUNegocio)WCFHelper.GetObject<MGBOQry.IUNegocio>(typeof(MGBOQry.UNegocio));
           objEUNeg.IdEmpresa = Session[ConstSessionVar.EMPRESA].ToString();
           objEUNeg.IdUNegocio = ddlidUNegocio.SelectedItem.Value;
           DataTable dt = objBOUNego.GetCCostoXUNegocio(objEUNeg);
           WebHelper.LoadListControl(ddlidCCosto, dt, "dsCCosto", "idCCosto", true, true);
       }

       public override void LoadDataEditPopup(GridView grid, int rowIndex)
       {
           this.ClearEditPopup();
           //this.LockControlsPopup();

           if (grid == grdListRem)
           {
               DataRow dr = this.GridGetRowFromDataKey(this.DataSourceRem, grdListRem, rowIndex);

               if (dr == null)
                   return;

               WebHelper.RowToControl(dr, "idForPago", ddlidForPago);
               WebHelper.RowToControl(dr, "idTipoRemu", ddlidTipRemu);
               WebHelper.RowToControl(dr, "idMoneda", ddlidMoneda);
               WebHelper.RowToControl(dr, "mtRemu", txtmtRemu);
           }

       }

       public new void ClearEditPopup()
       {
           this.txtmtRemu.Text = "";
       }

       public void LockControlsPopup()
       {
           switch (this.GridEditAction)
           {
               case GridEditAction.AddNew:
               case GridEditAction.Edit:

                   break;
               case GridEditAction.Delete:
                   this.ddlidForPago.Enabled = false;
                   this.ddlidTipRemu.Enabled = false;
                   this.ddlidMoneda.Enabled = false;
                   this.txtmtRemu.Enabled = false;
                   break;
           }
       }

       public override void SaveData(String key)
       {
           if (this.ValidateData() == false)
               return;

           IEntityBase objE = (IEntityBase)this.CreateEntitySet();

           IBOUpdate objPro = (IBOUpdate)WCFHelper.GetObject<IBOUpdate>(typeof(RHBOMnt.Personal));

           String[] strRet = objPro.UpdateData(objE);
           String strMsg = "";

           switch (this.FormEditAction)
           {

               case FormEditAction.AddNew:
               case FormEditAction.Copy:
                   strMsg = "Se ha registrado el Personal : " + strRet[0].ToString();
                   break;
               default:
                   strMsg = "Se ha modificado el Personal : " + txtidPersonal.Text;
                   break;
           }
           this.hdnMsgOPB.Value = this.CreatePostbackMessage(0, strMsg, "wfPersonalBnd.aspx");
       }

       public override void DeleteData()
       {
           IEntityBase objE = (IEntityBase)this.CreateEntitySet();
           IBOUpdate objPro = (IBOUpdate)WCFHelper.GetObject<IBOUpdate>(typeof(RHBOMnt.Personal));
           objPro.DeleteData(objE);

           this.hdnMsgOPB.Value = this.CreatePostbackMessage(0, "Se anulo el Personal  : " + txtidPersonal.Text, "wfPersonalBnd.aspx");

       }



       public override void LockControls()
       {
           if (this.ddlidCateTrab.SelectedItem.Value != "")
               this.ddlidCateTrab.Enabled = false;

           switch (this.ddlidCateTrab.SelectedItem.Value)
           {
               case ConstCategoriaTrab.TRABAJADOR:
                   this.chkstMadreResp.Enabled = false;
                   this.ddlidCentroFP.Enabled = false;
                   this.ddlidTipoCenFP.Enabled = false;
                   this.ddlidCateOcup.Enabled = true;
                   this.ddlidRegLaboral.Enabled = true;
                   this.ddlidNivEduc.Enabled = true;
                   this.txtdsOcupa.Enabled = true;
                   this.txtdsOcupa.Enabled = true;
                   this.ddlidRegPensi.Enabled = true;
                   this.txtfeInsRegPen.Enabled = true;
                   this.txtnuCuspp.Enabled = true;
                   this.ddlidSctrSalud.Enabled = true;
                   this.ddlidSctrPens.Enabled = true;
                   this.ddlidTipoCont.Enabled = true;
                   this.ddlidEmpEps.Enabled = true;
                   this.ddlidSituEmple.Enabled = true;
                   this.ddlidPeriRemu.Enabled = true;
                   this.ddlidEstaCivil.Enabled = true;
                   this.chkstDiscapa.Enabled = true;
                   this.chkstJTAtipico.Enabled = true;
                   this.txtdsOcupa.ReadOnly = false;
                   this.chkstJTMaxima.Enabled = true;
                   this.chkstJTHoraNoc.Enabled = true;
                   this.chkstOtrosIng5ta.Enabled = true;
                   this.chkstSindical.Enabled = true;
                   this.chkst5taExo.Enabled = true;
                   this.chkstAsigFami.Enabled = true;
                   this.chkstSujRegAlter.Enabled = true;
                   this.txtfeInsRegPen.ReadOnly = false;
                   this.txtfeInsRegPen.Enabled = true;
                   this.tabChildPrinci.Enabled = true;
                   this.tabChildDComple.Enabled = true;
                   break;
               case ConstCategoriaTrab.PENSIONISTA:
                   this.ddlidRegLaboral.Enabled = false;
                   this.ddlidNivEduc.Enabled = false;
                   this.txtdsOcupa.Enabled = false;
                   this.txtdsOcupa.Enabled = false;
                   this.ddlidRegPensi.Enabled = false;
                   this.txtfeInsRegPen.Enabled = false;
                   this.txtnuCuspp.Enabled = false;
                   this.ddlidSctrSalud.Enabled = false;
                   this.ddlidSctrPens.Enabled = false;
                   this.ddlidTipoCont.Enabled = false;
                   this.ddlidEmpEps.Enabled = false;
                   this.ddlidSituEmple.Enabled = false;
                   this.ddlidPeriRemu.Enabled = false;
                   this.ddlidEstaCivil.Enabled = false;
                   this.chkstMadreResp.Enabled = false;
                   this.ddlidCentroFP.Enabled = false;
                   this.ddlidTipoCenFP.Enabled = false;
                   this.chkstDiscapa.Enabled = false;
                   this.chkstJTAtipico.Enabled = false;
                   this.txtdsOcupa.ReadOnly = true;
                   this.chkstJTMaxima.Enabled = false;
                   this.chkstJTHoraNoc.Enabled = false;
                   this.chkstOtrosIng5ta.Enabled = false;
                   this.chkstSindical.Enabled = false;
                   this.chkst5taExo.Enabled = false;
                   this.chkstAsigFami.Enabled = false;
                   this.chkstSujRegAlter.Enabled = false;
                   this.txtfeInsRegPen.ReadOnly = true;
                   this.txtfeInsRegPen.Enabled = false;
                   this.tabChildPrinci.Enabled = true;
                   this.tabChildDComple.Enabled = true;
                   break;
               case ConstCategoriaTrab.PRESTADOR_4ta_CAT:
               case ConstCategoriaTrab.PERSONAL_TERCEROS:
                   this.txtnuRUC.Enabled = true;
                   this.tabChildPrinci.Enabled = false;
                   this.tabChildDComple.Enabled = false;
                   break;
               case ConstCategoriaTrab.PRESTADOR_MOD_FORMATIVA:
                   this.ddlidRegPensi.Enabled = true;
                   this.txtfeInsRegPen.Enabled = true;
                   this.txtnuCuspp.Enabled = true;
                   this.ddlidRegLaboral.Enabled = false;
                   this.ddlidNivEduc.Enabled = false;
                   this.ddlidRegPensi.Enabled = false;
                   this.txtfeInsRegPen.Enabled = false;
                   this.txtnuCuspp.Enabled = false;
                   this.ddlidSctrSalud.Enabled = false;
                   this.ddlidSctrPens.Enabled = false;
                   this.ddlidTipoCont.Enabled = false;
                   this.ddlidEmpEps.Enabled = false;
                   this.ddlidSituEmple.Enabled = false;
                   this.ddlidPeriRemu.Enabled = false;
                   this.ddlidEstaCivil.Enabled = false;
                   this.txtfeInsRegPen.ReadOnly = true;
                   this.tabChildPrinci.Enabled = true;
                   this.tabChildDComple.Enabled = false;
                   break;
           }

       }

   }
}